<template>
  <div class="app-container">
    <detail-table :columns="columns" :detail="detail" />
  </div>
</template>

<script>
import { getTeacherDetail } from '@/api/basic'
import DetailTable from '@/components/detail-table/index'
import { teacherDetailColumns } from '../../columns'

export default {
  components: { DetailTable },
  data() {
    return {
      columns: teacherDetailColumns,
      detail: {}
    }
  },
  mounted() {
    this.getDetail()
  },
  methods: {
    async getDetail() {
      const id = this.$route.params.id
      try {
        const res = await getTeacherDetail({
          id: Number(id)
        })
        if (res) {
          this.detail = res
        }
      } catch (err) {
        console.log('接口出错')
      }
    }
  }
}
</script>
<style scoped lang="less">
  .app-container {
    background: #fff;
  }
</style>
